package com.tsunami.exception;

import com.tsunami.exception.code.ExceptionCode;

/**
 * @Classname BizException
 * @Description TODO 自定义异常
 * @Date 2021-09-10 18:29
 * @Created by lx
 */
public class BizException  extends RuntimeException{
//    @ApiModelProperty(value = "错误信息")
    protected final String message;
//    @ApiModelProperty(value = "错误代码")
    protected final Integer code;

    public BizException(String message,Integer code)
    {
        this.message = message;
        this.code = code;
    }
    public BizException(ExceptionCode ex)
    {
        this.message = ex.getMsg();
        this.code = ex.getCode();
    }
    public BizException(String message,Integer code, Throwable e)
    {
        super(message, e);
        this.message = message;
        this.code = code;
    }
    @Override
    public String getMessage()
    {
        return message;
    }

    public Integer getCode() {
        return code;
    }
}
